package com.yuw.hw20190214;

import java.text.MessageFormat;

public class Company {
    // 成员变量
    // 打印的工资月份
    private int caculateMonth;
    private ColaEmployee colaEmployee;
    // 行为方法

    /**
     * 打印员工工资
     */
    public void printEmployeeSalary(){
//        System.out.println(caculateMonth+"月份工资：姓名："
//                + colaEmployee.getEmpName()+",工资金额："
//                + colaEmployee.getSalary(caculateMonth)
//        );

        // 带占位符的格式
        String strFormat = "{0}月份工资：姓名：{1},工资金额：{2}";
        // 占位符需要替换的参数数组（以数组的形式或变长参数的形式提供可以替换的参数）
        String strMessage = MessageFormat.format(strFormat,
                caculateMonth,colaEmployee.getEmpName(),
                colaEmployee.getSalary(caculateMonth));
        System.out.println(strMessage);
    }

    public Company(int caculateMonth, ColaEmployee colaEmployee) {
        this.caculateMonth = caculateMonth;
        this.colaEmployee = colaEmployee;
    }

    public Company() {
    }

    public int getCaculateMonth() {
        return caculateMonth;
    }

    public void setCaculateMonth(int caculateMonth) {
        this.caculateMonth = caculateMonth;
    }

    public ColaEmployee getColaEmployee() {
        return colaEmployee;
    }

    public void setColaEmployee(ColaEmployee colaEmployee) {
        this.colaEmployee = colaEmployee;
    }
}
